// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   FuncDefGroupServiceImpl.java

package com.hfstu.ifs.dataaccess.service.impl;

import com.hfstu.framework.core.orm.Page;
import com.hfstu.framework.core.orm.PageRequest;
import com.hfstu.ifs.dataaccess.dao.IFuncDefGroupDao;
import com.hfstu.ifs.dataaccess.service.IFuncDefGroupService;
import com.hfstu.ifs.model.FuncDefGroup;
import java.io.Serializable;
import java.util.*;

public class FuncDefGroupServiceImpl
	implements IFuncDefGroupService
{

	private IFuncDefGroupDao funcDefGroupDao;

	public FuncDefGroupServiceImpl()
	{
		funcDefGroupDao = null;
	}

	public FuncDefGroup save(FuncDefGroup entity)
	{
		return (FuncDefGroup)funcDefGroupDao.save(entity);
	}

	public FuncDefGroup update(FuncDefGroup entity)
	{
		return (FuncDefGroup)funcDefGroupDao.update(entity);
	}

	public FuncDefGroup saveOrUpdate(FuncDefGroup entity)
	{
		return (FuncDefGroup)funcDefGroupDao.saveOrUpdate(entity);
	}

	public void delete(String id)
	{
		funcDefGroupDao.delete(id);
	}

	public void delete(FuncDefGroup entity)
	{
		funcDefGroupDao.delete(entity);
	}

	public FuncDefGroup getById(String id)
	{
		return (FuncDefGroup)funcDefGroupDao.getById(id);
	}

	public List getByIds(String ids[])
	{
		return funcDefGroupDao.getByIds(ids);
	}

	public List findAll()
	{
		return funcDefGroupDao.findAll();
	}

	public List findListByCondition(Map filterPropertyMap, Map sortValueMap)
	{
		return funcDefGroupDao.findListByCondition(filterPropertyMap, sortValueMap);
	}

	public Page findPageByCondition(PageRequest pageRequest, Map filterPropertyMap, Map sortValueMap)
	{
		return funcDefGroupDao.findPageByCondition(pageRequest, filterPropertyMap, sortValueMap);
	}

	public void deleteAllById(String id)
	{
		List childrenIds = getAllChildrenId(id);
		if (childrenIds != null && childrenIds.size() != 0)
			funcDefGroupDao.deleteByIds((String[])childrenIds.toArray(new String[childrenIds.size()]));
		funcDefGroupDao.delete(id);
	}

	public List getAllChildrenId(String id)
	{
		List results = null;
		Map filterPropertyMap = new HashMap();
		filterPropertyMap.put("funcDefGroup.parentId", id);
		List list = funcDefGroupDao.findListByCondition(filterPropertyMap, null);
		if (list != null && list.size() != 0)
		{
			results = new ArrayList();
			for (Iterator iterator = list.iterator(); iterator.hasNext();)
			{
				FuncDefGroup funcDefGroup = (FuncDefGroup)iterator.next();
				results.add(funcDefGroup.getId());
				List childrens = getAllChildrenId(funcDefGroup.getId());
				if (childrens != null)
					results.addAll(childrens);
			}

		}
		return results;
	}

	public List getAllParentId(String id)
	{
		List results = null;
		FuncDefGroup funcDefGroup = (FuncDefGroup)funcDefGroupDao.getById(id);
		if (funcDefGroup != null)
		{
			results = new ArrayList();
			List parentIds = getAllParentId(funcDefGroup.getParentId());
			if (parentIds != null)
			{
				results.add(funcDefGroup.getParentId());
				results.addAll(parentIds);
			}
		}
		return results;
	}

	public IFuncDefGroupDao getFuncDefGroupDao()
	{
		return funcDefGroupDao;
	}

	public void setFuncDefGroupDao(IFuncDefGroupDao funcDefGroupDao)
	{
		this.funcDefGroupDao = funcDefGroupDao;
	}

	public volatile Object getById(Serializable serializable)
	{
		return getById((String)serializable);
	}

	public volatile Object save(Object obj)
	{
		return save((FuncDefGroup)obj);
	}

	public volatile Object saveOrUpdate(Object obj)
	{
		return saveOrUpdate((FuncDefGroup)obj);
	}

	public volatile void delete(Object obj)
	{
		delete((FuncDefGroup)obj);
	}

	public volatile void delete(Serializable serializable)
	{
		delete((String)serializable);
	}

	public volatile List getByIds(Serializable aserializable[])
	{
		return getByIds((String[])aserializable);
	}

	public volatile Object update(Object obj)
	{
		return update((FuncDefGroup)obj);
	}
}
